xen/arm: p2m: Use a whitelist rather than blacklist in get_page_from_gfn
authorJulien Grall <julien.grall@arm.com>
Thu, 28 Jul 2016 14:20:07 +0000 (15:20 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 29 Jul 2016 00:41:35 +0000 (17:41 -0700)
commitca8e5ddaa416983dd2b5840cb86eb768b8ebf8e9
tree67571f59de32faf6d7cf883688bebfde538c511c
parentb3acfb3f470da3cc5c7b460fcff316bcc9ecc380
xen/arm: p2m: Use a whitelist rather than blacklist in get_page_from_gfn

Currently, the check in get_page_from_gfn is using a blacklist. This is
very fragile because we may forgot to update the check when a new p2m
type is added.

To avoid any possible issue, use a whitelist. All type backed by a RAM
page can could potential be valid. The check is borrowed from x86.

Note with this change, it is not possible anymore to retrieve a page when
the p2m type is p2m_iommu_map_*. This is fine because they are special
mappings for direct mapping workaround and the associated GFN should be
used at all by callers of get_page_from_gfn.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/include/asm-arm/p2m.h